package org.cpoy.ei.session;

import org.cpoy.eims.entity.*;
import org.jboss.seam.annotations.Name;
import org.jboss.seam.framework.EntityQuery;
import java.util.Arrays;

@Name("relationshipList")
public class RelationshipList extends EntityQuery<Relationship> {

	private static final String EJBQL = "select relationship from Relationship relationship";

	private static final String[] RESTRICTIONS = {
			"lower(relationship.relationName) like lower(concat(#{relationshipList.relationship.relationName},'%'))",
			"lower(relationship.relationDesc) like lower(concat(#{relationshipList.relationship.relationDesc},'%'))", };

	private Relationship relationship = new Relationship();

	public RelationshipList() {
		setEjbql(EJBQL);
		setRestrictionExpressionStrings(Arrays.asList(RESTRICTIONS));
		setMaxResults(25);
	}

	public Relationship getRelationship() {
		return relationship;
	}
}
